package com.song.user.controller;

import com.song.api.controller.user.HelloControllerApi;
import com.song.grace.result.GraceJSONResult;
import com.song.utils.RedisOperator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController implements HelloControllerApi {

    private static final Logger LOG = LoggerFactory.getLogger(HelloController.class);

    @Autowired
    private RedisOperator redis;

    @Override
    public Object getHello(){

        LOG.info("Hello");
        return GraceJSONResult.ok();
    }


    @GetMapping("/redis")
    public Object redis() {
        redis.set("name", "songsong");
        return redis.get("name");
    }

}
